package com.googlecode.mailnet.emf.netmodel.visualization;

import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.Shape;
import org.eclipse.swt.graphics.Color;

import com.googlecode.mailnet.info.INodeInfo;

public class GrayFaultNodeDecorator extends ShapeDecorator {
	
	INodeInfo nodeInfo;
	
	public GrayFaultNodeDecorator(INodeInfo nodeInfo) {
		this.nodeInfo = nodeInfo;
	}
	
	@Override
	public boolean outlineShape(Shape shape, Graphics g) {
		shape.setLineStyle(Graphics.LINE_SOLID);
		shape.setForegroundColor(new Color(null, 100, 100, 100));
		shape.setLineStyle(nodeInfo.isBroken() ? Graphics.LINE_DASH : Graphics.LINE_SOLID);
		shape.setLineWidth(1);
		return super.outlineShape(shape, g);
	}

	public boolean fillShape(Shape shape, Graphics g) {
		shape.setBackgroundColor(nodeInfo.isBroken() ? new Color(null, 230, 230, 230) : new Color(null, 200, 255, 200));
		return false;
	}
}
